﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Bussiness;
using System.Data;

namespace WebApplication.Admin
{
    public partial class XuatPhieuChi : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                LoadPhieuchi();
            }
        }
        public void LoadPhieuchi()
        {
            if (Session["phieuchi"] != null)
            {
                DataTable data = (DataTable)Session["phieuchi"];
                List<string> LstMapc = new List<string>();
                string mapc = "";
                for (int i = 0; i < data.Rows.Count; i++)
                {
                    mapc = data.Rows[i]["mapc"].ToString();
                    LstMapc.Add(mapc);
                }
                DateTime dt=Commomcs.convertDate(DateTime.Now.ToString("dd/MM/yyyy"));
                string ngay="Ngày :"+dt.ToString("dd/MM/yyyy");
                if (LstMapc.Count > 0)
                { 
                     var source = new Microsoft.Reporting.WebForms.ReportDataSource("XuatPhieuChi",new Baocao.XuatPhieuChi().Getphieuchi(ngay,LstMapc));
                     ReportViewer1.LocalReport.ReportPath = @"Admin\Baocao\PhieuChi.rdlc";
                     ReportViewer1.LocalReport.DataSources.Clear();
                     ReportViewer1.LocalReport.DataSources.Add(source);
                     ReportViewer1.LocalReport.Refresh();
                }
                
            }
        }
    }
}